<template>
  <div class="neditor-wrap">
    <vue-neditor-wrap v-model="content"
                      :config="myConfig"></vue-neditor-wrap>
  </div>
</template>

<script>
import VueNeditorWrap from 'vue-neditor-wrap'
import config from '@/config'
export default {
  data () {
    return {
      myConfig: {
        // 如果需要上传功能,找后端小伙伴要服务器接口地址
        serverUrl: process.env.NODE_ENV === 'development' ? config.baseUrl.dev + 'php/controller.php' : config.baseUrl.dev + '/php/controller.php',
        // 你的UEditor资源存放的路径,相对于打包后的index.html
        UEDITOR_HOME_URL: process.env.NODE_ENV === 'development' ? config.baseUrl.dev + 'static/NEditor/' : config.baseUrl.dev + 'static/NEditor/',
        // 编辑器不自动被内容撑高
        autoHeightEnabled: false,
        // 初始容器高度
        initialFrameHeight: 480,
        // 初始容器宽度
        initialFrameWidth: '100%',
        // 关闭自动保存
        enableAutoSave: false,

        wordCount: false,

        zIndex: 500,

      },
      content: ''
    }
  },
  components: {
    VueNeditorWrap
  },
  watch: {
    content (val, oldval) {
      this.$emit('changeMsg', val)
    }
  },
  props: {
    msg: {
      type: String,
      default: ''
    }
  },
  created () {
    this.content = this.msg
  }
}

</script>
